Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix annotation deserializing for the Wasi and Wcgi runners #3715

Merged
merged 4 commits into from
Mar 28, 2023

Conversation

Michael-F-Bryan
Copy link
Contributor

@Michael-F-Bryan Michael-F-Bryan commented Mar 28, 2023

Here are a couple small fixes I added while making the wcgi-rust-template and wcgi-php-template work.

The key difference is that wapm2pirita will nest all annotations in your wasmer.toml file under an extra level (here).

That means, instead of a webc::metadata::CommandV2 looking like this

{
  "runner": "https://webc.org/runner/wcgi",
  "annotations": {
    "wcgi": {
      "dialect": "rfc-3875"
    }
  }
}

and being able to call command.get_annotations::<Wasi>("wasi"), the annotations actually look like this:

{
  "runner": "https://webc.org/runner/wcgi",
  "annotations": {
    "https://webc.org/runner/wcgi": {
      "wcgi": {
        "dialect": "rfc-3875"
      }
    }
  }
}

... and you need to create a temporary struct with the correct annotation types (e.g. webc::metadata::annotations::Wasi and webc::metadata::annotations::Wcgi in the WCGI case) so you can do let MyAnnotations { wcgi, wasi } = command.get_annotations(webc::metadata::annotations::WCGI_BASE_URI).

@Michael-F-Bryan Michael-F-Bryan changed the title Small fixes for the Wasi and Wcgi runners Fix annotation deserializing for the Wasi and Wcgi runners Mar 28, 2023
Copy link
Contributor

@ptitSeb ptitSeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I'm not very relevent in this subject.

@Michael-F-Bryan Michael-F-Bryan merged commit 34dcb3f into master Mar 28, 2023
@Michael-F-Bryan Michael-F-Bryan deleted the runner-fixes branch March 28, 2023 13:48
@Michael-F-Bryan Michael-F-Bryan mentioned this pull request Mar 30, 2023
Michael-F-Bryan pushed a commit that referenced this pull request Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants